/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * finishDialog.java
 *
 * Created on 11-mag-2010, 11.14.28
 */

package connectFour.GUI;

/**
 *
 * @author Ross
 */
public class EndDialog extends javax.swing.JDialog {


    /** Creates new form finishDialog */
    public EndDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        endLabel = new javax.swing.JLabel();
        closeButton = new javax.swing.JButton();
        winLabel = new javax.swing.JLabel();
        winnerName = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Partita terminata");
        setResizable(false);

        endLabel.setFont(new java.awt.Font("Tahoma", 1, 18));
        endLabel.setText("LA PARTITA E' TERMINATA");

        closeButton.setText("chiudi");
        closeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                closeButtonActionPerformed(evt);
            }
        });

        winLabel.setFont(new java.awt.Font("Tahoma", 1, 18));
        winLabel.setText("HA VINTO IL GIOCATORE:");

        winnerName.setFont(new java.awt.Font("Tahoma", 1, 18));
        winnerName.setText("nome player");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(249, Short.MAX_VALUE)
                .addComponent(closeButton)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(endLabel)
                    .addComponent(winnerName)
                    .addComponent(winLabel))
                .addContainerGap(38, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(45, 45, 45)
                .addComponent(endLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(winLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(winnerName)
                .addGap(18, 18, 18)
                .addComponent(closeButton))
        );

        pack();
    }// </editor-fold>

    private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {
       this.dispose();
    }



    // Variables declaration - do not modify
    private javax.swing.JButton closeButton;
    private javax.swing.JLabel endLabel;
    private javax.swing.JLabel winLabel;
    private javax.swing.JLabel winnerName;
    // End of variables declaration

    public void setWinner(String player){
        if(!player.equals("Pareggio"))
            winnerName.setText(player);
        else{
            winLabel.setText("NON HA VINTO NESSUNO");
            winnerName.setText("");
        }

    }
}
